<#include "/macro.include"/>
<#include "/java_copyright.include">
<#assign className = table.className>
<#assign classNameLower = className?uncap_first>
package ${basepackage}.controller.api;

import javax.validation.Valid;
import io.swagger.annotations.*;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import ${basepackage}.controller.api.dto.${className}Dto;

<#include "/java_imports.include">
@Api(value = "${classNameLower}ServiceApi", tags = "${table.remarks}接口", produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping("/${classNameLower}ServiceApi")
public interface  ${className}ServiceApi {

	/**
     *
     * <save one>
     * @param ${classNameLower}Dto
     * @return ResultDTO<Integer>
     */
	@ApiOperation(value = "save ${className}", notes = "save one", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE,response = ResultDTO.class)
	@ApiImplicitParams({@ApiImplicitParam(
			name = "${classNameLower}Dto",
			value = "Json参数",
			required = true
	)})
	//	@ApiResponses(value = {
	//			@ApiResponse(code = MessageConstant.INTERNAL_ERROR, message = MessageConstant.INTERNAL_ERROR_MSG)})
	@PostMapping
	ResultDTO<Integer> insert${className}(@RequestBody @Valid ${className}Dto ${classNameLower}Dto);

	 /**
     *
     * <update one>
     * @param ${classNameLower}Dto
     * @return ResultDTO<Integer>
     */
	@ApiOperation(value = "update ${className}", notes = "update one", httpMethod = "PUT", produces = MediaType.APPLICATION_JSON_VALUE,response = ResultDTO.class)
	@ApiImplicitParams({@ApiImplicitParam(
			name = "${classNameLower}Dto",
			value = "${classNameLower}Dto",
			required = true
	)})
	//	@ApiResponses(value = {
	//			@ApiResponse(code = MessageConstant.INTERNAL_ERROR, message = MessageConstant.INTERNAL_ERROR_MSG)})
	@PutMapping
	ResultDTO<Integer> update${className}(@RequestBody @Valid ${className}Dto ${classNameLower}Dto);

	 /**
     *
     * <find one by id>
     * @param id
     * @return ResultDTO<${className}Dto>
     */
	@ApiOperation(value = "query ${className}", notes = "find one by id", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_VALUE,response = ResultDTO.class)
	@ApiImplicitParams({@ApiImplicitParam(
			name = "id",
			value = "id",
			required = true
	)})
	//	@ApiResponses(value = {
	//			@ApiResponse(code = MessageConstant.INTERNAL_ERROR, message = MessageConstant.INTERNAL_ERROR_MSG),
	//			@ApiResponse(code = MessageConstant.NO_DATA, message = MessageConstant.NO_DATA_MSG)})
	@GetMapping(value = "/get${className}ById")
	ResultDTO<${className}Dto> get${className}ById(@RequestParam("id") ${table.idColumn.simpleJavaType} id);


	/**
	 *
	 * <find one by id>
	 * @param id
	 * @return ResultDTO<${className}Dto>
	 */
	@ApiOperation(value = "query ${className}", notes = "find one by id", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_VALUE,response = ResultDTO.class)
	@ApiImplicitParams({@ApiImplicitParam(
			name = "id",
			value = "id",
			required = true
	)})
	//	@ApiResponses(value = {
	//			@ApiResponse(code = MessageConstant.INTERNAL_ERROR, message = MessageConstant.INTERNAL_ERROR_MSG),
	//			@ApiResponse(code = MessageConstant.NO_DATA, message = MessageConstant.NO_DATA_MSG)})
	@GetMapping(value = "/{id}")
	ResultDTO<${className}Dto> get${className}ById(@PathVariable(value="id") ${table.idColumn.simpleJavaType} id);

	 /**
     *
     * <query all>
     * @param pageParsDTO
     * @return ResultDTO<List<${className}Dto>>
     */
	@ApiOperation(value = "query all ${className}", notes = "Paging query ${className}", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_VALUE,response = ResultDTO.class)
	@ApiImplicitParams({@ApiImplicitParam(
			name = "pageParsDTO",
			value = "pageParsDTO",
			required = true
	)})
	//	@ApiResponses(value = {
	//			@ApiResponse(code = MessageConstant.INTERNAL_ERROR, message = MessageConstant.INTERNAL_ERROR_MSG),
	//			@ApiResponse(code = MessageConstant.NO_DATA, message = MessageConstant.NO_DATA_MSG)})
	@PostMapping(value = "/query")
	ResultDTO<PageResultDTO<${className}Dto>> search${className}(@RequestBody PageParsDTO<Map> pageParsDTO);
}
